<?php

// +----------------------------------------------------------------------
// | EasyAdmin
// +----------------------------------------------------------------------
// | PHP交流群: 763822524
// +----------------------------------------------------------------------
// | 开源协议  https://mit-license.org 
// +----------------------------------------------------------------------
// | github开源项目：https://github.com/zhongshaofa/EasyAdmin
// +----------------------------------------------------------------------


namespace app\admin\model;


use app\common\model\TimeModel;
use app\common\service\WeginService;

class SystemConfig extends TimeModel
{
        // 定义全局的查询范围
        protected $globalScope = ['uniacid'];

        public function scopeUniacid($query)
        {
            if(WeginService::getUniacid())
            $query->where('uniacid', WeginService::getUniacid());
        }

        public static function onBeforeInsert($model)
        {
            $model->uniacid = WeginService::getUniacid();
        }
    
        public static function onBeforeUpdate($model)
        {
            $model->uniacid = WeginService::getUniacid();
        }
}